package com.oauth2.domain;

import lombok.Getter;
import lombok.Setter;

/**
 * @author shipeilei
 * @date 2020-7-17 12:10:26
 * @desc desc
 */
@Getter
@Setter
public class JsonResult<Data> {
    public static final int SUCCESS = 1;
    public static final int FAIL = 0;

    private int result;
    private String msg;
    private Data data;

    public JsonResult() {
    }

    public JsonResult(int result, String msg) {
        this.result = result;
        this.msg = msg;
    }

    public JsonResult(int result, String msg, Data data) {
        this.result = result;
        this.msg = msg;
        this.data = data;
    }

    public static JsonResult fail(String msg) {
        final JsonResult result = new JsonResult(FAIL, msg);
        return result;
    }
}
